package com.example.gamecaro;



import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;

public class MainActivity extends Activity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_main);
		
		//Xử Lý nút thoát
		ImageButton btn_exit=(ImageButton)findViewById(R.id.ibExit);
		btn_exit.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				//finish();
				System.exit(0);
				finish();
			}
		});
		
		//Xử lý nút About
		ImageButton btn_About=(ImageButton)findViewById(R.id.ibOptions);
		btn_About.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent outintend=new Intent("com.example.gamecaro.About");
				startActivity(outintend);
				
			}
		});
		//Xử lý Singleplayer
		ImageButton btn_Singleplayer=(ImageButton)findViewById(R.id.ibsinglebutton);
		btn_Singleplayer.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent outintend=new Intent(MainActivity.this,Singleplayer.class);
				outintend.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(outintend);
			}
		});
		//xử lý Multiplayer
		ImageButton btn_Multiplayer=(ImageButton)findViewById(R.id.ibMultiButton);
		btn_Multiplayer.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent outinted=new Intent("com.example.gamecaro.Multipleyer");
				startActivity(outinted);
			}
		});
		//Xử lý Lan
		ImageButton btn_Lan=(ImageButton)findViewById(R.id.ibLAN);
		btn_Lan.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent outintend=new Intent("com.example.gamecaro.BlutoothLan");
				startActivity(outintend);
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
